/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.lct.eq2.backup;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Me
 */
public class MulticastClient extends Thread {
    private Object data;
    private String lctServer;
    
    public MulticastClient(Object o, String server) {
        this.data = o;
        this.lctServer = server;
    }
    
    @Override
    public void run() {
        ObjectOutputStream oos = null;
        Socket sock = null;
        try {
            sock = new Socket(this.lctServer, 13268);
            oos = new ObjectOutputStream(sock.getOutputStream());
            oos.writeObject(this.data);
        } catch (IOException ex) {
            Logger.getLogger(MulticastClient.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            try {
                oos.close();
                sock.close();
            } catch (IOException ex) {
                Logger.getLogger(MulticastClient.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
}
